package com.shouer.doc.ui.healthreportedit.adapter;

import android.content.Context;
import android.support.v7.widget.RecyclerView;
import android.text.TextUtils;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import com.shouer.doc.R;
import com.shouer.doc.ui.neworder.model.StuffRemark;

import java.util.List;

/**
 * Created by YYY-Work on 2017/8/23.
 */

public class StuffRemarkAdapter extends RecyclerView.Adapter<StuffRemarkVH> {

    private Context context;
    private List<StuffRemark> stuffRemarks;
    private LayoutInflater layoutInflater;

    public StuffRemarkAdapter(Context context, List<StuffRemark> stuffRemarks) {
        this.context = context;
        this.stuffRemarks = stuffRemarks;
        layoutInflater = LayoutInflater.from(context);
    }


    @Override
    public StuffRemarkVH onCreateViewHolder(ViewGroup parent, int viewType) {
        View itemView = layoutInflater.inflate(R.layout.activity_health_record_stuff_remark_item, null);
        return new StuffRemarkVH(itemView);
    }

    @Override
    public void onBindViewHolder(StuffRemarkVH holder, int position) {

        StuffRemark stuffRemark=stuffRemarks.get(position);

        holder.titleView.setText("建议"+(++position));
        holder.subTitleView.setText(TextUtils.isEmpty(stuffRemark.getSubTitle())?"无":stuffRemark.getSubTitle());
        holder.subDescView.setText(TextUtils.isEmpty(stuffRemark.getSubDesc())?"无":stuffRemark.getSubDesc());

    }

    @Override
    public int getItemCount() {
        if (null == stuffRemarks)
            return 0;
        else
            return stuffRemarks.size();
    }
}
